from pymysql import Connection

conn = None
try:
    conn=Connection(
        host='localhost',
        port=3306,
        user='root',
        password='root',
        charset='utf8',
        database='db2',
        autocommit=True
    )
    cursor=conn.cursor()
    sql="""
        insert into t_user values
    
    """
    cursor.execute(sql)
    print('添加成功')
except Exception as e:
    print(e)
finally:
    if conn:
        conn.close()